package org.market.domain.strategy.repository;

import org.market.domain.strategy.model.entity.StrategyAwardEntity;
import org.market.domain.strategy.model.entity.StrategyEntity;
import org.market.domain.strategy.model.entity.StrategyRuleEntity;
import org.market.domain.strategy.model.valobj.RuleTreeVO;
import org.market.domain.strategy.model.valobj.StrategyAwadRuleModelVO;
import org.market.domain.strategy.model.valobj.StrategyAwardStockKeyVO;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;

/**
 * @Author: Insight
 * @Description: 策略仓储
 * @Date: 2025/2/4 下午11:01
 * @Version: 1.0
 */
public interface IStrategyRepository {
    /**
     * 获取策略奖品表的列表
     * @param strategyId
     * @return
     */
    List<StrategyAwardEntity> queryStrategyAwardList(Long strategyId);

    /**
     * 装配抽奖策略查询表
     * @param key
     * @param rateRange
     * @param shuffleStrategyAwardSearchRateTable
     */
    void storeStrategyAwardSearchRateTable(String key, BigDecimal rateRange, HashMap<Integer, Integer> shuffleStrategyAwardSearchRateTable);

    /**
     * 获取抽奖概率范围(千分位,万分位)
     * @param strategyId
     * @return
     */
    int getRateRange(Long strategyId);

    int getRateRange(String key);

    /**
     * 获取抽奖奖品id
     * @param key
     * @param rateKey
     * @return
     */
    Integer getStrategyAwardAssemble(String key, Integer rateKey);

    StrategyEntity queryStrategyEntityList(Long strategyId);

    StrategyRuleEntity queryStrategyRuleEntity(Long strategyId, String ruleWeight);

    String queryStrategyRuleValue(Long strategyId, Integer awardId, String ruleModel);

    String queryStrategyRuleValue(Long strategyId, String ruleModel);


    StrategyEntity queryStrategyEntityByStrategyId(Long strategyId);

    StrategyAwadRuleModelVO queryStrategyAwardRuleModel(Long strategyId, Integer awardId);

    RuleTreeVO queryRuleTreeVOByTreeId(String number);

    void cacheStrategyAwardCount(String cacheKey, Long awardCount);

    Boolean querySubtractAwardCount(String cacheKey);

    void awardStockConsumeSendQueue(StrategyAwardStockKeyVO build);

    StrategyAwardStockKeyVO queryTakeQueueValue();

    void updateStrategyAwardStock(Long strategyId, Integer awardId);
}
